package com.example.springboottransaction.controller;

import com.example.springboottransaction.pojo.Student;
import com.example.springboottransaction.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StudentController {
    @Autowired
    private StudentService studentService;

    @RequestMapping("/stu/add")
    public Student addStudent(String name, String sex) {
        return studentService.addStudent(name, sex);
    }

    @RequestMapping("/testReadOnlyTrue")
    public List<Student> testReadOnlyTrue(){
        return studentService.testReadOnlyTrue();
    }
}
